Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5383 cleanup facelets encoding management #5385

Merged
merged 4 commits into from
Jan 28, 2024

Conversation

BalusC
Copy link
Contributor

@BalusC BalusC commented Jan 20, 2024

#5383

Review/cleanup/refactor all code logic related to managing facelets/request/response encoding and centralized in a new Util#getResponseEncoding() method.

Also took the opportunity to get rid of all hardcoded strings representing "UTF-8" throughout the source code and replace them by StandardCharsets.UTF_8 (.name())

@BalusC BalusC changed the title Mojarra issue 5383 cleanup facelets encoding management #5383 cleanup facelets encoding management Jan 20, 2024
Copy link
Contributor

@mnriem mnriem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@BalusC BalusC merged commit facc1f9 into 4.0 Jan 28, 2024
3 checks passed
@BalusC BalusC deleted the mojarra_issue_5383_cleanup_facelets_encoding_management branch January 28, 2024 12:37
@BalusC BalusC added this to the 4.0.6 milestone Feb 10, 2024

if (encoding == null) {
// 5. If still none found then fall back to specified default.
encoding = defaultEncoding.get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is calling Optional.get() without checking emptiness, and the line 1629 is actually passing an empty Optional, resulting in NoSuchElementException: No value present.

Causing failures in Jakarta TCK:

Caused by: java.util.NoSuchElementException: No value present
	at java.base/java.util.Optional.get(Optional.java:143)
	at jakarta.faces.impl@4.0.6.redhat-00001//com.sun.faces.util.Util.getResponseEncoding(Util.java:1680)
	at jakarta.faces.impl@4.0.6.redhat-00001//com.sun.faces.util.Util.getResponseEncoding(Util.java:1629)
	at jakarta.faces.impl@4.0.6.redhat-00001//com.sun.faces.application.view.MultiViewHandler.getRedirectURL(MultiViewHandler.java:350)
	at jakarta.faces.impl@4.0.6.redhat-00001//jakarta.faces.application.ViewHandlerWrapper.getRedirectURL(ViewHandlerWrapper.java:278)
	at org.jboss.as.jsf-injection//org.jboss.weld.module.jsf.ConversationAwareViewHandler.getRedirectURL(ConversationAwareViewHandler.java:149)
	at jakarta.faces.impl@4.0.6.redhat-00001//jakarta.faces.application.NavigationCase.getRedirectURL(NavigationCase.java:171)
	at com.sun.ts//com.sun.ts.tests.jsf.api.jakarta_faces.application.navigationcase.TestServlet.navigationCaseGetRedirectURLTest(TestServlet.java:119)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.sun.ts//com.sun.ts.tests.jsf.common.servlets.HttpTCKServlet.invokeTest(HttpTCKServlet.java:163)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #5429

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants